#pragma once

#include "MathUtil.h"

// this struct represents the vertex format for the shapes generated in the functions below
struct BasicVertex
{
   float3 pos;   // position
   float3 norm;  // surface normal vector
   float2 tex;   // texture coordinate
};

// this struct represents the vertex format for all shapes generated in the functions below
struct TangentVertex
{
   float3 pos;   // position
   float2 tex;   // texture coordinate
   float3 uTan;  // texture coordinate u-tangent vector
   float3 vTan;  // texture coordinate v-tangent vector
};

// a colored vertex
struct ColoredVertex
{
   float3 pos;    // position
   float3 color;  // color
};

ref class SceneShapes
{
internal:
   SceneShapes(ID3D11Device *d3dDevice);
   void CreateBlock(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateTile(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateBillboard(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateColoredQuad(
      _In_ float3            color,
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateBox(
      float3                 radii,
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateSphere(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateTangentSphere(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );
   void CreateReferenceAxis(
      _Out_ ID3D11Buffer     **vertexBuffer,
      _Out_ ID3D11Buffer     **indexBuffer,
      _Out_opt_ unsigned int *vertexCount,
      _Out_opt_ unsigned int *indexCount
      );

private:
   Microsoft::WRL::ComPtr<ID3D11Device> m_d3dDevice;

   void CreateVertexBuffer(
      _In_ unsigned int  numVertices,
      _In_ BasicVertex   *vertexData,
      _Out_ ID3D11Buffer **vertexBuffer
      );

   void CreateIndexBuffer(
      _In_ unsigned int   numIndices,
      _In_ unsigned short *indexData,
      _Out_ ID3D11Buffer  **indexBuffer
      );

   void CreateTangentVertexBuffer(
      _In_ unsigned int  numVertices,
      _In_ TangentVertex *vertexData,
      _Out_ ID3D11Buffer **vertexBuffer
      );
};
